home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-03-19 | 52.5 KB | 1,501 lines | [TEXT/MPS ] |
- #########################################################################
- #########################################################################
- ## Copyright © Apple Computer, Inc. 1992-1997
- ## All rights reserved
- #########################################################################
- #########################################################################
- #
- # Library: Engines.lib
- #
- # Version: 2.1.4
- #
- # Description: Engines that will perform many common test case types
- #
- # Contains:
- # CheckWindowLoc()
- # CheckHelpBalloons()
- # CheckIcons()
- # CheckActions()
- # CheckRadioButtons()
- # CheckOpenCloseCDEV()
- # CheckArea()
- # xxx()
- # xxx()
- # xxx()
- #
- # History:
- # Date: By: Changes:
- # 09/27/96 SBR/MSO Updated copyright header
- # Use SPEC exception handling method (ExceptionHandling.lib)
- # 01/21/97 SBR Deleted older exception code and comments.
- #
- #########################################################################
- #########################################################################
-
- Libraries
- "Additions.lib",
- "Clouseau.lib",
- "Report.lib",
- "TargetControl.lib",
- "VUAid.lib",
-
- "TCS.lib", # to report Phoenix test cases
- "ExceptionHandling.lib";
-
-
- #########################################################################
- # task CheckWindowLoc(testType, testList, CDEVName )
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Performs Close/Reopen tests on the named CDEV
- # Parameters: CDEVName: name of CDEV to open and test
- # testList:= {test1, test2, ... testN}
- # testN: { testType, TCSID, nameOfTest, CDEVWindowLoc_list, closeMethod}
- # testType: 1 = QuickLook, 2 = Functional, 3 = Comprehensive
- # TCSID: { Number (int), Set (str), Type (str), Owner (str) }
- # nameOfTest: short test description (TCSDescription)
- # CDEVWindowLoc_list: where to drag the window before closing
- # closeMethod: how to close the window, default is cmd-w
- # Returns: Nothing
- # Examples: sampletest:= {
- # { 1, "at center top", {screenRect[3]/3, 25}
- # { 1, {1,'WindowLoc','Functional','HLQ'},"at center top",
- # {(screenRect[3]/2) - ((originalLocation[3] - originalLocation[1])/2),25}, "box"},
- # };
- # CheckWindowLoc(3, sampletest, 'Sound');
- # Assumptions: Note in defining testList that the close box must be visible for
- # the "box" option to work properly.
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 3/19/92 Jon Marsh Created
- # 10/04/93 Jay Loucks Added second attempt to move window if first
- # attempt fails
- # 06/21/94 SBR Mods for TCS.lib; added comments for TestN;
- # 09/27/96 BRL/MSO Added SPEC exception handling
- #########################################################################
- task CheckWindowLoc(testType:= 1, testList := {}, CDEVname:= 'NoNameDefined')
- begin
- rOpenTest("{CDEVName} CDEV window location/Close tests");
-
- prep := true;
- reset();
-
- if not open_control_panel(CDEVName)
- prep := false;
- else
- begin
- try
- match [window t:CDEVName r:?originalLocation]!;
- catch theError
- ExceptionDispatcher(theError,,{"Match 1 in CheckWindowLoc", {testType, testList, CDEVname}});
- end;
-
- if not originalLocation
- prep := false;
- else
- begin
- try
- match [screen m:true r:?screenRect]!;
- catch theError
- ExceptionDispatcher(theError,,{"Match 2 in CheckWindowLoc", {testType, testList, CDEVname}});
-
- if not screenRect
- prep := false;
- end;
-
-
- if prep
- begin
- for each test in testList #Loop through all tests
- begin
- if test[1] <= testType #Is the test in QL,Func or Comp?
- begin
- TCSID := test[2]; #Extract test parameters
- testName := test[3]; #Extract test parameters
- testLoc := test[4];
- testMethod := test[5];
- tResult := {}; #initialize test result
-
- ## SBR Comment: this is the same description for all test cases
- TCSResultCode := 0; TCSErrStr := ''; TCSValue := ''; TCSString := '';
- TCSStart(TCSID, "save window location for a control panel");
-
- #Make sure we can see the whole title Bar
- _Drag([window o:1], 'a', {32, 64});
- _Drag([window o:1], 'a', testLoc); #Begin test - position window
- #& verify!
-
- wRect := {};
- try
- match [window t:CDEVName o:1 r:?wRect]!;
- catch theError
- ExceptionDispatcher(theError,,{"Match 3 in CheckWindowLoc", {[screen m:true], testList, CDEVname}});
-
- if (not wRect) or (wRect[1] <> testLoc[1]) or (wRect[2] <> testLoc[2])
- begin #### begin second attempt to move window
- wait(2);
- _Drag([window o:1], 'a', testLoc); #try again; if fail, return with error
-
- wRect := {};
- try
- match [window t:CDEVName o:1 r:?wRect]!;
- catch theError
- ExceptionDispatcher(theError,,{"Match 4 in CheckWindowLoc", {testType, testList, CDEVname}});
-
- if (not wRect) or (wRect[1] <> testLoc[1]) or (wRect[2] <> testLoc[2])
- begin
- TCSResultCode := -1;
- TCSErrStr := "Unable to locate or drag window";
- tResult := {"incomplete",TCSErrStr};
- end;
- end;
-
- if testMethod = "box" #How do we close?
- begin
- if not close_window()
- begin
- TCSResultCode := -1;
- TCSErrStr := "Unable to close window by close box";
- tResult := {"incomplete",TCSErrStr};
- end;
- end;
- else if testMethod = "menu"
- begin
- if not select_menuItem('Close Window','File')
- begin
- TCSResultCode := -1;
- TCSErrStr := "Unable to select Close Window menuItem";
- tResult := {"incomplete",TCSErrStr};
- end;
- end;
- else
- key_eq('w');
- # & verify!
- if not await_absence([window t:CDEVName])
- begin
- TCSResultCode := -1;
- TCSErrStr := "{CDEVName} CDEV didn't close properly using close {testMethod}";
- tResult := {"incomplete",TCSErrStr};
- end;
-
- open_control_panel(CDEVName); #Reopen & verify!
-
- newLocation := {};
- try
- match [window t:CDEVName o:1 r:?newLocation]!;
- catch theError
- ExceptionDispatcher(theError,,{"Match 5 in CheckWindowLoc", {testType, testList, CDEVname}});
-
- if tResult = {} #if no incompletes, do the main check
- begin
- if newLocation <> wRect
- begin
- TCSResultCode := 0;
- TCSErrStr := "{CDEVName} CDEV opened in wrong location when {testName}";
- tResult := {false, TCSErrStr};
- RAddResult("", NumToStr(wRect[0]) + "," + NumToStr(wRect[1]),
- NumToStr(newLocation[0]) + "," + NumToStr(newLocation[1]));
- end;
- else
- begin
- TCSResultCode := 1;
- TCSErrStr := '';
- TCSString := "{testLoc}";
- tResult := {true, "{CDEVName} CDEV opened in correct location when {testName}"};
- end;
- end;
-
- ### Report to Phoenix
- #println "TCSEnd( {TCSID}, {TCSResultCode}, {TCSErrStr}, {TCSValue} )";
- TCSEnd( TCSID, TCSResultCode, TCSErrStr, (*TCSValue*), TCSString );
- # TCSEnd( pTCSId := {}, pResultCode := '', pErrStr := '', pTCSVal := 0,
- # pTCSStr := '', pCommentStr := '', pExceptionFlag := '');
- #
- rResult(tResult[1], tResult[2]); #report the findings
- end;
- end;
-
- #Restore initial conditions
- _Drag([window o:1], 'a', {originalLocation[1], originalLocation[2]});
- end;
- else # Error from the get-go
- rResult("incomplete", "{CDEVName} CDEV window not found");
-
- rCloseTest();
- end;
-
- #########################################################################
- # task CheckHelpBalloons(testType, testList, fullPathName)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Turns Help Balloons on, moves around enabling and checking
- # them, then turns them off again.
- # Parameters: testType:= 1,2,3 for QuickLook, Functional, InDepth
- # testList:= {test1, test2, ... testN}
- # testN: { testType, TCSID, nameOfTest, mouseLoc, expectedChecksum }
- # testType: 1 = QuickLook, 2 = Functional, 3 = Comprehensive
- # TCSID: { Number (int), Set (str), Type (str), Owner (str) }
- # nameOfTest: short test description (TCSDescription)
- # mouseLoc: where to point to make the balloon appear
- # expectedChecksum: string to compare against VUAid('balloon')
- # fullPathName (optional): if included, will open the pathName
- # given. Default is to operate on current status of windows.
- # Returns: Nothing
- # Examples: sampletest:= {
- # { 1, {1,'SampleCP','BalloonHelp','HLQ'}, "close box", {15, 10}, '11305'}
- # { 1, {2,'SampleCP','BalloonHelp','HLQ'}, "title bar", {60, 10}, '34759'}
- # };
- # CheckHelpBalloons(1, sampletest);
- # Assumptions: None
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 3/19/92 Jon Marsh Created
- # 2/24/94 Gary Kratzer If help ballon checksum test fails, move the mouse to another
- # location, move it back to the test location, wait a few seconds,
- # then test it again. If this test fails, then fail the test. We
- # do this because sometimes the wrong help balloon appears if the
- # cursor passes over another help region on the way to the test
- # location, and VUAid is called before the correct balloon gets
- # displayed.
- # 06/21/94 SBR Mods for TCS.lib; added comments for TestN;
- # 09/27/96 BRL/MSO Added SPEC exception handling
- #########################################################################
- task CheckHelpBalloons(testType:= 1, testList:= {}, fullPathName := "", NameOpenTest:= "")
- begin
- if NameOpenTest <> ""
- NameOpenTest := " for " + NameOpenTest;
- rOpenTest("Help Balloon verification tests {NameOpenTest}");
-
- if fullPathName <> ""
- begin
- reset();
- open_by_path(fullpathName);
- end;
-
- try
- match [menuItem t:?balloonsOn:/≈Balloons≈/];
- catch theError
- ExceptionDispatcher(theError,,{"CheckHelpBalloons",
- {testType, testList, fullPathName, NameOpenTest}});
-
- if balloonsOn = 'Hide Balloons'
- success := true;
- else
- success := select_descriptor([menuItem t:'Show Balloons']!);
-
- if success
- begin
- for each test in testList
- begin
- if test[1] <= testType
- begin
- TCSID := test[2];
- testName := test[3];
- testLoc := test[4];
- expected := test[5];
-
- TCSResultCode := 0; TCSErrStr := ''; TCSValue := ''; TCSString := '';
- TCSStart(TCSID, "help balloon ckecksum for {testName}");
-
- if TypeOf(testLoc[1]) = "list" or TypeOf(testLoc[1]) = "string"
- move_mouse(testLoc);
- else
- move_mouse({testLoc});
-
- actual := VUAid("Balloon");
-
- ### If test fails, move the mouse and try again
- ### Changed from (actual <> expected) for Radar 1276224
- if not (actual = expected)
- begin
- move_mouse({'absolute',{0,0}}, 2);
- if TypeOf(testLoc[1]) = "list" or TypeOf(testLoc[1]) = "string"
- move_mouse(testLoc);
- else
- move_mouse({testLoc});
- wait(2);
- actual := VUAid("Balloon");
- end;
-
- if typeOf(actual) = 'string'
- TCSValue := strToNum(actual); #current type for VU 2.0.1
- else
- TCSValue := actual; #future type for VU 2.1
-
- if actual = expected
- begin
- TCSResultCode := 1;
- TCSErrStr := '';
- tResult := {true,"balloon for {testName}"};
- end;
- else
- begin
- TCSResultCode := 0;
- TCSErrStr := "expected checksum was {expected}";
- tResult := {false,"balloon for {testName}"};
- end;
-
- ### Report to Phoenix
- #println "TCSEnd( {TCSID}, {TCSResultCode}, {TCSErrStr}, {TCSValue} )";
- TCSEnd( TCSID, TCSResultCode, TCSErrStr, TCSValue );
- # TCSEnd( pTCSId := {}, pResultCode := '', pErrStr := '', pTCSVal := 0,
- # pTCSStr := '', pCommentStr := '', pExceptionFlag := '');
- #
- CAidedSE := {test, {-4, "Balloon"}};
- rResult (tResult[1],tResult[2], expected, actual,,CAidedSE); #log results of the test
- end;
- end;
- end;
-
- ## SBR Comment: how do we report this or the next 'if' to TCS?
- else # Error from the get-go
- rResult("incomplete", "Unable to enable help balloons");
-
- if not select_descriptor([menuItem t:'Hide Balloons']!)
- rIncomplete("Incomplete: Unable to disable help balloons");
-
- rCloseTest();
- end;
-
- #########################################################################
- # task _IconsSetup(ItemName, kTempFolderName, ThisDir)
- # Description: Sets up environment for CheckIcons.
- # Parameters: itemName: Name of item to test
- # kTempFolderName: Name of new temporary folder
- # ThisDir: Pathname to Control Panels folder
- # Returns: error string - "none" indicates successful completion
- # History:
- # 4/6/92 Jon Marsh Created
- # 10/04/93 Jay Loucks Turn off 'show disk info in header' to
- # ensure that title bar is expected height
- # 11/9/93 Jay Loucks Change open_control_panel() call to use
- # new parameter to not close Control Panels window
- # 09/27/96 BRL/MSO Added SPEC exception handling
- #########################################################################
- task _IconsSetup(ItemName, kTempFolderName, ThisDir)
- begin
- # Open and locate Views CDEV
- rStatus("_IconsSetup: Configuring windows for {ItemName} icon verification tests", 4);
- try
- match [window t:?ourWindow o:1];
- catch theError
- ExceptionDispatcher(theError,,{"match 1 in _IconsSetup", {ItemName, kTempFolderName, ThisDir}});
-
- ### JDL Open Views, but do not close Control Panels window
- if not open_control_panel("Views",false)
- return("Couldn∂'t open Views CDEV");
-
- if ourWindow <> "Control Panels"
- begin
- _Select([window t:"Control Panels"]);
- if not select_menuItem("Close Window","File")
- return ("Unable to close Control Panels window");
- end;
-
- _Drag([window o:1 t:"Views"], 'a', {110, 25});
- try
- match [window o:1 t:"Views" r:?wRect]!;
- catch theError
- ExceptionDispatcher(theError,,{"match 2 in _IconsSetup", {ItemName, kTempFolderName, ThisDir}});
-
- ### JDL if show disk info in header is on, turn it off
- if _MatchBoolean([checkbox t:'Show disk info in header' s:{1,1}])
- if not select_descriptor([checkbox t:'Show disk info in header'])
- return ("Unable to turn off disk info in header");
-
- if (wRect[1] <> 110) or (wRect[2] <> 25)
- return ("Unable to move Views window");
-
- # Return to window, make an alias
- # of desired item
- _Select([window t:ourWindow]);
- type_keys({tabKey});
-
- if not type_keys({ItemName, 'latch', commandKey, 'i'})
- return("type_keys error (1)");
-
- if not await_presence([window o:1 t:(ItemName + " Info")])
- return("Wrong Item selected?");
-
- if not select_MenuItem("Close Window","File")
- return("Unable to select Close menuItem for info window");
-
- if not await_presence([window t:ourWindow])
- return("original window is not foremost");
-
- if not select_MenuItem("Make Alias","File")
- return("Unable to make Alias");
-
- if not select_MenuItem("None","Label")
- return("Unable to select Label:none");
-
- # Make a temporary folder to put it in
- if not select_MenuItem("New Folder","File")
- return("Unable to make new folder");
-
- if not type_keys({kTempFolderName, returnKey})
- return("type_keys error (2)");
-
- if await_presence([staticText t:/≈Please use a different name≈/],2,,,6)
- begin
- type_keys({returnKey});
- VUAid("Delete", {ThisDir + kTempFolderName});
- type_keys({kTempFolderName});
- end;
-
- if not type_keys({'latch', commandKey, 'latch', optionKey, downarrowKey})
- return("type_keys error (3)");
-
- if not await_presence([window o:1 t:kTempFolderName])
- return("Unable to open temp folder");
-
- if not select_MenuItem("by Name","View")
- return("Unable to view by name");
-
- if not relocate_window( {5,25,105,145})
- return("Relocating temp folder failed");
-
- # Move our alias to the folder
- if not VUAid("Move", {ThisDir + ItemName + " alias", ThisDir + kTempFolderName})
- return ("Unable to move alias into temp folder");
- return("none");
- end;
-
- #########################################################################
- # task CheckIcons(testType, testList, ItemName, ThisDir)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Checks that an icon is displayed properly, with variable
- # sizes and bit-depths.
- # Parameters: testType:= 1,2,3 for QuickLook, Functional, Comprehensive
- # testList:= {test1, test2, ... testN}
- # testN: { testType, TCSID, bitDepth, iconSize, selected, expectedChecksum, gray}
- # testType: 1 = QuickLook, 2 = Functional, 3 = Comprehensive
- # TCSID: { Number (int), Set (str), Type (str), Owner (str) }
- # bitDepth: depth at which to measure the checksum
- # iconSize: 'small', 'normal', or 'large' icon as set in Views CP
- # selected: measure with icon highlighted (true) or not (false)
- # expectedChecksum: string to compare against VUAid('CompareWindowRect')
- # gray: Monitors CP set to Grays 'grays' or Colors (nothing)
- # ItemName: Name of Item to test
- # ThisDir: window which contains the icon to be checked
- # defaults to Control Panels folder
- # Returns: None
- # Examples: testList:= {
- # {1, {1,'SampleCP','Icon','HLQ'}, 8, "large", false, 457},
- # {1, {2,'SampleCP','Icon','HLQ'}, 8, "normal", true, 23749, 'grays'}
- # };
- # CheckIcons(1, testList, "Monitors");
- # Assumptions: Calls _IconsSetup
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 4/6/92 Jon Marsh Created
- # 10/04/93 Jay Loucks Changed to CompareWindowRect from
- # Compare32WindowRect to remove variation
- # in results.
- # 2/9/94 Donal O'Hare Grays Setting in Monitors CP will now default to
- # Colors unless otherwise specified.
- # 06/21/94 SBR Mods for TCS.lib; added comments for TestN;
- #########################################################################
- task CheckIcons(testType:= 1, testList:= {}, ItemName := "", ThisDir := "")
- begin
- rOpenTest("Icon display verification tests for {ItemName}");
- kTempFolderName := "@!@ DeleteMe";
- if ThisDir = ""
- ThisDir := VUAid("Findfolder", {"ctrl"}) + ":";
- if ThisDir[card ThisDir] <> ":" ThisDir := ThisDir + ":";
-
- reset();
- open_by_path(ThisDir);
-
- error := _IconsSetup(ItemName, kTempFolderName, ThisDir);
- if error = "none"
- begin
- oldBitDepth := VUAid("GetDepth"); # Remember for resoration
- oldGray := VUAid("GetGray");
-
- currentBitDepth := oldBitDepth; # Optimize repetitive setups
- currentGray := oldGray;
- currentView := "who knows?";
- bitDepthNA := 0; # Last known bit-depth unavailable on this machine
- grayNA := -1; # Last known gray setting unavailable on this machine
- testGray := 0; # DOH: Default the Grays Setting in Monitors CP to Colors
- testGrayText := 'colors'; # SBR: Default to colors for the text, also.
-
- for each test in testList
- begin
- if test[1] <= testType
- begin
- TCSID := test[2];
- testBitDepth := test[3];
- testView := test[4];
- testSelected := test[5];
- if testSelected
- testSelectedText := "selected";
- else testSelectedText := "unselected";
- expected := test[6];
- if card test > 6 # DOH: Check to see if the Grays Setting in Monitors CP
- begin # is given and set it appropriately.
- testGrayText := test[7];
- if testGrayText = 'grays'
- testGray := 1;
- else begin
- testGrayText := 'colors';
- testGray := 0;
- end;
- end;
-
- TCSResultCode := 0; TCSErrStr := ''; TCSValue := ''; TCSString := '';
- TCSDescription := "Color CP icon checksum, {testView}, {testSelectedText}";
- TCSDescription := "{TCSDescription}, in {testBitDepth}-bit {testGrayText}";
- TCSStart(TCSID, TCSDescription);
-
- actual := "";
- tResult := {};
- #Skip test if we know that the bit-depth or gray setting is not available
- if (testBitDepth <> bitDepthNA) and (testGray <> grayNA)
- begin # Change our icon size
- if testView <> currentView
- begin
- select_window("Views");
- if testView = "large"
- begin
- move_mouse({{130,187}, 'click'});
- checkSumRect := {24, 22, 56, 54}; #32x32
- end;
- else if testView = "small"
- begin
- move_mouse({{94,187}, 'click'});
- checkSumRect := {22, 21, 38, 37}; #16x16
- end;
- else begin
- move_mouse({{58,187}, 'click'});
- checkSumRect := {20, 22, 32, 34}; #12x12
- end;
- select_window(kTempFolderName);
- end;
- # Select or de-select it
- if testSelected
- begin
- key_eq("a");
- testSelected := "true"; # Redefine our boolean as a string for logging purposes
- end;
- else begin
- move_mouse({{5, 45}, 'click'});
- testSelected := "false";
- end;
- # Change our bit-depth
- if (testBitDepth <> currentBitDepth)
- begin
- VUAid("SetDepth", {testBitDepth});
- b := VUAid("GetDepth");
- if b <> testBitDepth
- begin
- bitDepthNA := testBitDepth;
- tResult := {"incomplete", "Unable to set bit depth to {testBitDepth} with gray:{testGray}"};
- TCSResultCode := -1;
- TCSErrStr := "Unable to set bit depth to {testBitDepth} with gray:{testGray}";
- end;
- end;
- # Change our grays
- if (testGray <> currentGray)
- begin
- VUAid("SetGray", {testGray});
- b := VUAid("GetGray");
- if b <> testGray
- begin
- grayNA := testGray;
- tResult := {"incomplete", "Unable to set grays to {testGray}"};
- TCSResultCode := -1;
- TCSErrStr := "Unable to set grays to {testGray}";
- end;
- end;
-
- if tResult = {} # Do our checksum over our region
- begin
- #### JDL - changed VUAid call from 'CompareWindow32Rect'
- #### to CompareWindowRect to remove variation in results
- actual := VUAid("CompareWindowRect", checkSumRect);
-
- if actual <> integer
- TCSValue := strToNum(actual); #current type for VU 2.0.1
- else TCSValue := actual; #future type for VU 2.1
-
- TCSResultCode := actual = expected;
- if TCSResultCode
- TCSResultCode := 1;
- else TCSResultCode := 0;
- tResult := { TCSResultCode, TCSDescription };
-
- if TCSResultCode
- begin
- TCSErrStr := '';
- end;
- else begin
- TCSErrStr := "expected checksum was {expected}";
- #### DOH - If failing > Alert users to check that the testCases contain the correct CheckSum's.
- RStatus("NB: Check that- gray -is included in the testCases if Gray Checksums are being used.");
- end;
- end;
- else actual := expected;
-
- currentView := testView;
- currentBitDepth := testBitDepth;
- currentGray := testGray;
-
- ### Report to Phoenix
- #println "TCSEnd( {TCSID}, {TCSResultCode}, {TCSErrStr}, {TCSValue} )";
- TCSEnd( TCSID, TCSResultCode, TCSErrStr, TCSValue );
- # TCSEnd( pTCSId := {}, pResultCode := '', pErrStr := '', pTCSVal := 0,
- # pTCSStr := '', pCommentStr := '', pExceptionFlag := '');
- #
- CAidedSE := {test, { -5, "CompareWindowRect", checkSumRect}};
- rResult(tResult[1], tResult[2], expected, actual,,CAidedSE);
- end;
- end;
- end;
- # Restore original settings
- if oldBitDepth <> currentBitDepth
- VUAid("SetDepth", {oldBitDepth});
- VUAid("SetGray", {oldGray});
- # Delete temporary stuff
- if not VUAid("Delete", {ThisDir + kTempFolderName + ":" + ItemName + " Alias"})
- rIncomplete("Incomplete: Unable to delete alias to CDEV ∂'{ItemName}∂'");
- else if not VUAid("Delete", {ThisDir + kTempFolderName})
- rIncomplete("Incomplete: Unable to delete temporary folder ∂'{kTempFolderName}∂'");
- close_window("Views");
-
- end;
- else # Error from the get-go
- rResult("incomplete","{error}");
-
- rCloseTest();
- end;
-
-
- #########################################################################
- # task CheckActions(testType, testList)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: combines several diverse handlers and verification
- # methods into one handler
- # Parameters: testList:= {test1, test2, ... testN}
- # testN: { testType, testName, genericActionLists, expectedDesc}
- # testType: 1,2,3 for QuickLook, Functional, Comprehensive
- # testName: name of this testcase
- # genericActionLists: { actionList1Type, actionList1,..., actionListNType, actionListN}
- # actionListNType: "move_mouse", "type_keys",
- # "scrapbook", "menus", "pushCheckSum", "verifyCheckSum"
- # actionListN: Depends on actionListNType:
- # "move_mouse": parameters to pass to move_mouse
- # "type_keys": parameters to pass to type_keys
- # "scrapbook": parameters to pass to scrapbook
- # "menus": list of menu names to select.
- # If only 1 char long use key_eq.
- # "pushCheckSum":
- # { VUAidCommandString, parameterList}
- # VUAidCommandString: VUAid command string to execute.
- # Push result onto stack. Can be used (popped off
- # stack) later by verifyCheckSum
- # parameterList: parameters to send to VUAid.
- # "verifyCheckSum":
- # { VUAidCommandString, parameterList, change, checkSum}
- # VUAidCommandString: VUAid command string to execute.
- # parameterList: parameters to send to VUAid.
- # change: true/false - was change expected?
- # checkSum: resulting checkSum or checkSumList to verify. If
- # empty pop checkSum off getCheckSumStack.
- # testType:= 1,2,3 for QuickLook, Functional, Comprehensive
- # Returns: Nothing
- # Examples: testList:= {
- # { 1, "cut of 1st sound", {
- # "pushCheckSum", {"CompareWindowRect", {158, 22, 297, 35}},
- # "move_mouse", {gScrollUpArrowLoc, 'down', 'wait3', 'up', gSound1Loc, 'click'},
- # "menus", {"Cut"},
- # "verifyCheckSum", {"CompareWindowRect", {158, 22, 297, 35}, true}
- # }, [window o:1 t:"Sound"]}
- # };
- # CheckActions(1, testList);
- # Assumptions: None
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 4/9/92 Jon Marsh Created
- # 6/9/92 Jon Marsh Added stack for checksum verification
- # Updated for rResult logging.
- # 09/27/96 BRL/MSO Added SPEC exception handling
- #########################################################################
- task CheckActions( testType:= 1, testList:= {})
- begin
- rOpenTest("generic action verification tests");
-
- noErr:= true;
- inc := false;
- originalCheckSum:= {};
- for each test in testList
- begin
- if test[1] <= testType
- begin
- testName := test[2];
- genericActionLists := test[3];
- expectedDesc := test[4];
-
- if rXStatus(5)
- println "Processing generic actionList: ", test;
- while card genericActionLists > 0
- begin
- actionType:= genericActionLists[1];
- actionList:= genericActionLists[2];
- genericActionLists:= remove(1, genericActionLists);
- genericActionLists:= remove(1, genericActionLists);
-
- CAidedSE:= {};
- if actionType = "move_mouse"
- noErr:= move_mouse(actionList);
- else if actionType = "type_keys"
- noErr:= type_keys(actionList);
- else if actionType = "scrapbook"
- noErr:= scrapbook(actionList);
- else if actionType = "menus"
- begin
- for each m in actionList
- begin
- if card m = 1
- noErr:= key_eq(m);
- else
- noErr := select_descriptor([menuItem t:m]);
- if not noErr
- actionList := {};
- end;
- end;
- else if actionType = "pushCheckSum"
- begin
- if typeOf(actionList[1]) = 'string'
- originalCheckSum := originalCheckSum + { VUAid(actionlist[1], actionList[2]) };
- else
- inc := rAddResult("pushCheckSum needs a VUAid command and parameter list");
- end;
- else if actionType = "verifyCheckSum"
- begin
- if card actionList < 4
- begin
- checkSum := originalCheckSum[1];
- originalCheckSum := remove(1, originalCheckSum);
- end;
- else
- begin
- checkSum := actionList[4];
- CAidedSE := { {checkSum}, {-1, actionList[1]} };
- if typeOf(checkSum) = 'list'
- begin
- checkSum := whichCheckSum(checkSum);
- CAidedSE := { {checkSum}, {1, actionList[1]} };
- end;
- end;
- if typeOf(actionList[1]) = 'string'
- begin
- newCheckSum := VUAid(actionList[1], actionList[2]);
- if actionList[3] = (newCheckSum <> checkSum)
- begin
- if actionList[3]
- rAddResult("Verified change in display for {testName}");
- else
- rAddResult("Verified no change in display for {testName}");
- end;
- else
- begin
- noErr:= false;
- if actionList[3]
- rAddResult("Unable to verify changed display for {testName}",checkSum,newCheckSum);
- else
- rAddResult("Unable to verify unchanged display for {testName}",checkSum,newCheckSum);
- end;
- end;
- else
- inc := rAddResult("verifyCheckSum needs a VUAid command string");
- end;
- else
- inc := rAddResult("checkActions recieved bad actionType: {actionType}");
-
- if (not noErr) or inc
- begin
- rAddResult("Aborting generic action handler");
- genericActionLists:= {};
- end;
-
- end; # while card genericActionLists > 0
-
- if noErr and (not inc)
- if not await_presence(expectedDesc,,,,6) #v_level 6 to suppress errors
- noErr := not rAddResult("Expected descriptor not found for {testName}");
- if inc
- noErr := "incomplete";
- rResult(noErr, "{testName}",,,, CAidedSE);
-
- while _MatchBoolean([button t:"Cancel"]) or _MatchBoolean([button t:"OK"])
- begin
- if _MatchBoolean([button t:"Cancel"])
- select_descriptor([button t:"Cancel"]);
- else
- select_descriptor([button t:"OK"]);
- end;
- end; #if test[1] <= testType
- end; #for each test in testList
-
- rCloseTest();
- end;
-
-
- ##########################################################################################
- # task CheckRadioButton(testType, testList, cdev)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Checks that a RadioButton(radiobutton) is selected properly.
- # Parameters:
- # testList: {testType, testName, buttonLocation, buttonList,
- # MemSize, MemLocation, expected}
- #
- # testType: 1 = QL, 2 = Func, 3 = Comp
- # testName: string identifying this particular test
- # buttonLocation: location of the button being clicked
- # buttonList: List of all buttons in the radio group where
- # each element is a location (see Note 2 below)
- # and a highlight state ie., true or false.
- # MemSize: Size of memory element to check
- # (see VUAid 2.0 documentation).
- # MemLocation: Address of memory element to check
- # (see VUAid 2.0 documentation).
- # expected: expected value of memory location
- #
- # NOTE: 1)if no memory Location test needed,
- # pass no variables forMemSize, MemLocation,
- # and expected using commas{…,,,},
- # and this area will be ignored.
- # 2)The radio button location is given by
- # it's central x,y coordinates.
- #
- # cdev: { Control Panel Name , {x,y offset}}
- # Cdev Name: Control Panel Name whose RadioButtons
- # are to be tested.
- # x,y offset: Because CompareWindowRect uses a different
- # reference point to move_mouse,this offset must
- # be given. eg. For most Control Panels the offset
- # is { 0, -20},for Date & Time it is { -8, -10}, etc.
- #
- # Returns: Nothing
- # Example:
- # cdev := { "Memory", { 0, -20}};
- # testCases := {
- # {1, 'Symbol : Virtual Memory', {72, 125}, {{{72, 125}, 'true'},
- # {{72, 139}, 'false'} } }
- # };
- # CheckRadioButton(3, testCases, cdev);
- # NB:
- # 1) Using "InvertWindowRect" the offset can be found by calculating the difference between
- # the actual inverted area and the expected area.
- # 2) The coordinates for each buttonLocation must be the central x,y coordinates
- # relative to the window.
- # 3) To ensure that the correct buttonLocation coordinates are given it may be necessary to
- # calculate an area of 12*12 pixels(see CheckRadioButton task) and invert this area
- # using InvertWindowRect. Note: The inverted area must be directly on the appropriate
- # RadioButton,if not,change the buttonLocation coordinates.
- #
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 4/14/92 Al Allamsetty Created
- # 10/04/93 Jay Loucks Changed call to GetMemory to
- # work with VUAid 2.0 which requires a
- # memory size and location. Updated header.
- # 1/13/94 Donal 0'Hare Modified to fix Radar bug No. 1131363 & Updated header
- # 3/15/94 DOH Changed "rCloseTest(,true)" to "rCloseTest()"
- ##########################################################################################
- task CheckRadioButton(testType, testList:= {}, cdev:= {})
- begin
-
- CurBitDepth := VUAid("GetDepth");
- CurGrays := VUAid("GetGray");
- cdevName := cdev[1];
- offset := cdev[2];
- rOpentest("RadioButton tests for {cdevName}");
- prep := true;
-
- if not open_control_panel(cdevName) prep := false;
-
- if prep begin
- for each test in testList begin
- if test[1] <= testType begin
- testName := test[2];
- buttonLocation := test[3];
- buttonList := test[4];
- tResult := {};
-
- move_mouse({buttonLocation, 'click'});
-
- if card test > 4 begin #Only perform memLocation test if defined
- #### JDL - change call to work with VUAid 2.0 wich requires
- #### a size parameter
- MemSize := test[5];
- MemLocation := test[6];
- expected := test[7];
- actual := VUAid("GetMemory",{ MemSize, MemLocation });
- if actual = expected
- rAddResult("Verified: memory verification of radioButton {testName}");
- else begin
- tResult:= {false, "{testName} memory verification"};
- RAddResult("VUAid command GetMemory:",expected, actual);
- end;
- end;
-
- visualPassed := true;
- move_mouse( {{0,0}, 'relToWindow'} ); #Remove Mouse from radio button area.
-
- for each list in buttonList begin
- if tResult = {} begin
- buttonCoor := list[1];
- enabled := list[2];
- coorx := buttonCoor[1];
- coory := buttonCoor[2];
- ###Calculate the coordinates of an area 12*12pixel's on the RadioButton.
- windc1 := buttonCoor[1] - 6 + offset[1];
- windc2 := buttonCoor[2] - 6 + offset[2];
- windc3 := buttonCoor[1] + 6 + offset[1];
- windc4 := buttonCoor[2] + 6 + offset[2];
-
- state := VUAid("CompareWindowRect", {windc1, windc2, windc3, windc4}, 4);
- # Checksumlist for unselected radiobutton
- if state = whichCheckSum({ -13602,-14022,-13316,-26632,-20416,28768},CurBitDepth, CurGrays)
- act := 'false';
- # Checksumlist for selected radiobutton
- else if state = whichCheckSum({ 5102,8938,-32196,1144,-26816,10976 },CurBitDepth, CurGrays)
- act := 'true';
- else act := 'Unknown';
- if (act <> enabled or act = 'Unknown') visualPassed := false ;
- if not visualPassed
- tResult := {false, "CompareWindow verification of RadioButton {testName}"};
- end; #if tResult
-
- end; #for each list
-
- if tResult = {}
- tResult := {true, "RadioButton {testName}"};
- rResult(tResult[1], tResult[2]);
-
- end; #if testType
- end; #for each test
- if card buttonList > 1 and visualPassed
- RAddResult("Verified: all RadioButtons in correct state.");
- end; #if match
- else rResult("incomplete","Could not find an open {cdevName} window");
- rCloseTest();
- end;
-
-
-
- #########################################################################
- # task _OpenBy(method, itemName, aliasIt)
- # Description: Opens a CDEV by specified method. This is a support
- # task to CheckOpenCloseCDEV.
- # Parameters: Discussed in CheckOpenCloseCDEV header
- # Returns: true: successful completion
- # false: if any test was incomplete or if given an
- # invalid test case
- # History:
- # 04/02/92 SBR Created
- # 09/27/96 BRL/MSO Added SPEC exception handling
- #########################################################################
- task _OpenBy(method, itemDescriptor, itemWindow, itemName, targetFile, aliasIt)
- begin
- global gAliasMade;
-
- rStatus("Preparing item {itemName}.", 4);
-
- if isUndefined(global ctrlPath)
- ctrlPath := VUAid ("FindFolder", {"ctrl"});
-
- if not _MatchBoolean([window t:"Control Panels" o:1])
- begin
- reset(); #close all windows
- if not open_control_panel()
- return {"incomplete","Unable to open Control Panels"};
- end;
-
- if aliasIt
- begin
- if not gAliasMade
- begin
- if not select_named_item(itemName)
- return {"incomplete","Unable to select_named_item"};
- if not select_menuItem('Make Alias', 'File')
- return {"incomplete","Unable to select_menuItem"};
-
- #must clean up again or the alias may be behind another icon
- if not CleanUpByName()
- return {"incomplete","Unable to select_named_item"};
- global gAliasMade := true;
- end;
- targetItem := itemName + " alias";
- end;
- else targetItem := itemName;
-
- if method <> "appleMenu" #appleMenu doesn't use a point to icon routine
- if not point_to_sys_icon(ctrlPath, targetItem, "Control Panels")
- return {"incomplete","Unable to point_to_sys_icon for {method}"};
-
- rStatus("Finished preparing {targetItem}.", 4);
-
- ### At this point the item is selected and ready to open. If we are about to doubleClick
- ### the pointer is over the icon and ready for clicking.
-
- if (method = 'doubleClick')
- _DoubleClick();
-
- else if (method = 'optionDoubleClick')
- begin
- _PressKey({optionKey});
- _DoubleClick();
- _ReleaseKey({optionKey});
- end;
-
- else if (method = 'cmdO')
- key_eq('o',1);
-
- else if (method = 'cmdOptionO')
- key_eq('o',5);
-
- else if (method = 'cmdOptionZero')
- key_eq('0',5);
-
- else if (method = 'cmdDown')
- type_keys({'latch', commandKey, downArrowKey});
-
- else if (method = 'cmdOptionDown')
- type_keys({'latch', commandKey, 'latch', optionKey, downArrowKey});
-
- else if (method = 'fileMenuOpen')
- begin
- if not select_menuItem('Open', 'File')
- return {"incomplete", "menuItem ∂'Open∂' not enabled for selected {targetFile}"};
- end;
-
- else if (method = 'optionFileMenuOpen')
- begin
- _PressKey({optionKey});
- if not select_menuItem('Open', 'File')
- return {"incomplete", "menuItem ∂'Open∂' not enabled for selected {targetFile}"};
- _ReleaseKey({optionKey});
- end;
-
- else if (method = 'appleMenu') #NOTE this method does its own verification
- begin
- amnuPath := vuAid("FindFolder", {"amnu"});
-
- if not vuAid("move", {ctrlPath + ":" + targetItem, amnuPath})
- return {'incomplete',"Move to Apple Menu Items folder failed."};
-
- if not select_descriptor([menuitem t:targetFile m:[menu o:1]],5,6)
- return {'incomplete',"Selection of item in Apple Menu failed."};
-
- if not await_presence(itemDescriptor,,,,6)
- tResult := {false, "{targetFile} did not open by {method}."};
- else
- tResult := {true, "Verified open of {targetItem} by {method}."};
- key_eq("w"); # close before we move; not neccessary, only polite to the finder
-
- if not vuAid("move", {amnuPath + ":" + targetItem, ctrlPath})
- return {'incomplete','Item did not move back.'};
- return tResult;
- end;
-
- else # method is INVALID
- return {'incomplete','Invalid method ({method}) for open routine'};
-
- # Find the result of the test and print it out
- if not await_presence(itemDescriptor,,,,6)
- return {false,"{targetItem} did not open by {method}."};
- else
- tResult := {true, "open of {targetItem} by {method}"};
-
- if method ~= /≈ption≈/ # for option opens
- begin
- if not await_absence([window t:"Control Panels"])
- tResult := {false, "Control Panels window did not close by {method} behind {targetItem}."};
- else
- RAddResult("Verified: {itemWindow} closed correctly behind {targetItem}");
- end;
-
- return tResult;
- end;
-
-
- #########################################################################
- # task _CloseBy(method, itemDescriptor, itemName)
- # Description: Closes a CDEV by specified method. This is a support
- # task to CheckOpenCloseCDEV.
- # Parameters: Discussed in CheckOpenCloseCDEV header
- # Returns: true: successful completion
- # false: if any test was incomplete or if given an
- # invalid test case
- # History:
- # 04/02/92 SBR Created
- # 11/17/93 JDL Modified fileMenuClose option to select the
- # 'Close Window' menu item (there is no exact
- # match for a menu item 'Close'!)
- #########################################################################
- task _CloseBy(method := 'invalid', itemDescriptor, itemName)
- begin
- ### method is 'closeBox'
- if (method = 'closeBox')
- begin
- move_mouse({{15, 15}, 'click'});
- end;
-
- ### method is 'cmdW'
- else if (method = 'cmdW')
- begin
- key_eq('w');
- end;
-
- ### method is 'fileMenuClose'
- else if (method = 'fileMenuClose')
- begin
- if not select_menuItem('Close Window', 'File')
- return {"incomplete","menuItem ∂'Close Window∂' not enabled for {itemName}"};
- end;
-
-
- ### method is INVALID
- else
- return {"incomplete",'Invalid method ({method}) for closing a control panel.'};
-
- if not await_absence(itemDescriptor,,,,6)
- return {false,"close {itemName} by {method}"};
-
- return {true, "close {itemName} by {method}"}; #if we managed to make it to this point, item was closed correctly
- end;
-
-
- #########################################################################
- # task CleanUpByName()
- # Description: Clean up Finder Window by small icon name
- # Parameters: None
- # Returns: true: if successful completion
- # false: if error occurred
- # History:
- # 04/02/92 SBR Created
- # 09/27/96 BRL/MSO Added SPEC exception handling
- #########################################################################
- task CleanUpByName()
- begin
- if not select_menuitem("by Small Icon", "View") return false;
- _PressKey({optionKey});
- select_menuitem(/Clean Up≈/, "Special");
- _ReleaseKey({optionKey});
- return true;
- end;
-
- #########################################################################
- # task CheckOpenCloseCDEV(testType, itemDescriptor, testList, pathname)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Engine to open and/or close CDEVs using a list of test cases
- # (see also CheckOpenCloseDA, CheckOpenCloseFolder)
- # Parameters: testType: 1 = QuickLook, 2 = Functional, 3 = Comprehensive
- # itemDescriptor: A complete descriptor of the item's window. The title,
- # style, and ordinal traits must be included, and the ordinal must
- # be set to 1. Of course, the more complete this is, the stricter
- # the test, so you can include the c:, z:, and g: traits. The
- # engine attempts exact matches unless noted. Do not include any
- # rectangle traits, because they are in global coordinates.
- # testList: { test1, test2, ... testN };
- # testN: { testType, TCSID, action};
- # testType: 1 = QuickLook, 2 = Functional, 3 = Comprehensive
- # TCSID: { Number (int), Set (str), Type (str), Owner (str) }
- # action: { actionType, method [,'alias']};
- # actionType: 'Open' | 'Close' | 'all';
- # 'Open': The methods of opening the CDEV.
- # 'Close': The methods of closing the CDEV.
- # 'all': Not yet implemented.
- # method: One of a selection, depending on the actionType.
- # actionType = 'Open' (Open methods close the CDEV if it is not already closed.)
- # 'doubleClick' Double click the icon.
- # 'optionDoubleClick' Press option, double click the icon.
- # Finder window will close.
- # 'appleMenu' Move the item to the Apple Menu Items sub-folder if
- # necessary and open it by selecting in the Apple Menu.
- # 'cmdO' Select icon and type command-O.
- # 'cmdOptionO' Select icon and type command-option-O.
- # Finder window will close.
- # 'cmdOptionZero' Select icon and type command-option-Zero.
- # Finder window will close.
- # 'cmdDown' Select icon and type command-down arrow.
- # 'cmdOptionDown' Select icon and type command-option-down arrow.
- # Finder window will close.
- # 'fileMenuOpen' Select icon and choose 'Open' from File menu.
- # 'optionFileMenuOpen' Select, press option, choose 'Open' from File menu.
- # Finder window will close.
- # 'startupItem' Move the item to the Startup Items sub-folder if
- # necessary and restart. NOT IMPLEMENTED YET!
- # actionType = 'Close' (Close methods open the CDEV if it is not already open.)
- # 'closeBox' Click the item's close box.
- # 'cmdW' Select CDEV and type command-W.
- # 'fileMenuClose' Select CDEV and choose 'Close' from File menu.
- # 'alias': If included, make an alias to the original if necessary and use the
- # method(s) on the alias. If not included, use the method(s) on the
- # original item. Ignored except with 'Open' actionType.
- # pathname: not yet implemented
- # Returns: true: successful completion of all test cases
- # false: if any test failed or if given an invalid test case
- # Examples: testList:={
- # {1, {1,'SampleCP','OpenClose','HLQ'}, {'open','doubleClick'} },
- # {1, {2,'SampleCP','OpenClose','HLQ'}, {'close','closeBox'} },
- # {1, {3,'SampleCP','OpenClose','HLQ'}, {'close','fileMenuClose'} }
- # {2, {4,'SampleCP','OpenClose','HLQ'}, {'open','doubleClick', 'alias'} },
- # };
- # CheckOpenCloseCDEV(TestType, testList, [window t:'Views' o:1 s:document
- # g:false z:false]);
- # Assumptions: System 7 only.
- # Names are not so long as to be truncated when aliased.
- # All window names are unique.
- # Does NOT test: whether title bars change state
- # proper location, size or visual appearance of windows
- # CDEVs which are not in the Control Panels folder
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 04/02/92 SBR Created
- # 06/21/94 SBR Mods for TCS.lib
- # 09/27/96 BRL/MSO Added SPEC exception handling
- #########################################################################
- task CheckOpenCloseCDEV(testType := 1, testList := {}, itemDescriptor, pathname := '')
- begin
- itemName := itemDescriptor.t;
- prep := true;
-
- rOpenTest("Open and close tests for {itemName} control panel");
-
- rStatus('Initializing CheckOpenCloseCDEV.', 4);
- #SetDefaultViews(3);
- reset();
- if not await_presence([window t:'Desktop' o:1],,,,6) prep := false;
-
- #initPaths();
-
- itemWindow := 'Control Panels'; # the Finder window containing the item's icon
- if not open_control_panel() prep := false;
- if not CleanUpByName() prep := false;
-
- aliasIt := false; # this test needs an alias to work on
- global gAliasMade := false; # if true, delete the alias at end of engine
-
- rStatus('Finished initializing CheckOpenCloseCDEV, starting testList.', 4);
-
- ### testN := { testType, action };
- if prep begin
- for each test in testList
- begin
- if test[1] <= testType
- begin
- tResult := {};
- TCSID := test[2];
- action := test[3];
- actionType := action[1];
- method := action[2];
-
- if isMember('alias', action) # test an alias to the test file
- begin
- rStatus('Request for an alias.', 4);
- targetFile := itemName + ' alias';
- aliasIt := true;
- end;
- else begin # test the original file
- targetFile := itemName;
- aliasIt := false;
- end;
-
- rStatus("Attempting to {actionType} {targetFile} by {method}.", 4);
-
- if aliasIt
- TCSDescriptionStr := "{actionType} a control panel alias by {method}";
- else
- TCSDescriptionStr := "{actionType} a control panel by {method}";
- TCSResultCode := 0;
- TCSString := '';
- TCSErrStr := '';
- TCSStart(TCSID, TCSDescriptionStr);
-
- ##### actionType is OPEN
- if (actionType = 'open')
- begin
- ### Open methods close the CDEV if it's already open
- if _MatchBoolean([window t:itemName])
- begin
- select_window(itemName);
- key_eq('w');
- if not await_absence([window t:itemName],,,,6)
- begin
- errorString := "{itemName} would not close when preparing for open test";
- tResult := {"incomplete",errorString};
- end;
- else
- rStatus("{itemName} was already open. Closed it.", 4);
- end;
-
- if tResult = {}
- tResult:= _OpenBy( method, itemDescriptor, itemWindow, itemName, targetFile,
- aliasIt );
- end;
-
- ##### actionType is CLOSE
- else if (actionType = 'close')
- begin
- ### Close methods open the CDEV if it is already closed.
- if not _MatchBoolean([window t:itemName o:1])
- if not open_control_panel(itemName)
- begin
- errorString := "{itemName} did not open when preparing for close test.";
- tResult := {"incomplete",errorString};
- end;
-
- if tResult = {}
- tResult := _CloseBy(method, itemDescriptor, itemName);
- end;
-
- ##### actionType is INVALID
- else
- tResult := {"incomplete", 'Invalid actionType, skipping this test case.'};
-
- ##### check and log result
- if tResult = {}
- begin
- tResult := {"incomplete", "No result was found for test - please contact the scripter"};
- TCSResultCode := -1;
- TCSErrStr := tResult[2];
- end;
- else if (tResult[1] = 'pass') or (tResult[1] = true)
- begin
- TCSResultCode := 1;
- TCSErrStr := '';
- end;
- else if (tResult[1] = 'fail') or (tResult[1] = false)
- begin
- TCSResultCode := 0;
- TCSErrStr := tResult[2];
- end;
- else if tResult[1] = 'incomplete'
- begin
- TCSResultCode := -1;
- TCSErrStr := tResult[2];
- end;
-
- ### Report to Phoenix
- #println "TCSEnd( {TCSID}, {TCSResultCode}, {TCSErrStr} )";
- TCSEnd( TCSID, TCSResultCode, TCSErrStr );
- # TCSEnd( pTCSId := {}, pResultCode := '', pErrStr := '', pTCSVal := 0,
- # pTCSStr := '', pCommentStr := '', pExceptionFlag := '');
- #
- rResult( tResult[1], tResult[2] );
- tResult := {};
- end; # this test case
-
- end; # for each test in testList
-
- end; # if not prep
- else
- rResult( "incomplete", "Initialization failed for CheckOpenCloseCDEV");
-
- # Engine finished executing normally. Begin cleanup.
-
- rStatus("CheckOpenCloseCDEV cleaning up after all test cases done.",4);
- if gAliasMade begin # Delete the alias if one exists
- aliasPath := VUAid("FindFolder", {"ctrl"}) + ":" + itemName + " alias";
- vuAid("delete", {aliasPath});
- end;
-
- key_eq('w',5,4); # close all the windows
-
- rCloseTest();
- end; # open_close_CDEV
-
-
- #########################################################################
- # task CheckArea(testType, testList)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Checks whether the text is there or not.
- # Parameters: testList:= {test1, test2, ... testN}
- # testN: { testType, testName, testLoc{{areaCoor1}, {areaCoor2}}, state, '{expected}'}
- # textCoor1 is the starting coordinates(x, y) relative to window
- # textCoor2 is the ending coordinates(x, y) relative to window
- # testType:= 1,2,3 for QuickLook, Functional, Comprehensive
- # invert is whether invertwindow is to be invoked. If true invertwindow
- # is called and if false, it is not. Default is false.
- # Returns: Nothing
- # Examples: testList:= {
- # { 1, "key repeat rate", {{22, 29},{95, 38}}, {'5641', '10350', '19530', '41310'}}
- # };
- # CheckArea(1, testList);
- # Assumptions: Window for which area is being checked should be open
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 4/16/92 Al Allamsetty Created
- # 09/27/96 BRL/MSO Added SPEC exception handling
- #########################################################################
- task CheckArea(testType:= 1, testList:= {} , invert := false)
- begin
- CurBitDepth := VUAid("GetDepth");
-
- rOpenTest("Area verification tests");
-
- if _MatchBoolean([window o:1])
- begin
- OffSetList := {"Color", "Date & Time", "Easy Access", "General Controls", "Keyboard",
- "Labels", "Map", "Memory", "Monitors", "Mouse", "Numbers", "StartUp Disk",
- "Sound", "Text"};
-
- for each test in testList
- begin
- if test[1] <= testType
- begin
- testName := test[2];
- testLoc := test[3];
- expected := WhichCheckSum(test[4], CurBitDepth);
- areaCoor1 := testLoc[1];
- areaCoor2 := testLoc[2];
-
- m1 := _Match([window o:1]);
- if IsMember (m1.t, OffSetList)
- begin
- windc1 := areaCoor1[1] + 87;
- windc3 := areaCoor2[1] + 87;
- end;
- else
- begin
- windc1 := areaCoor1[1] + 87 - 89;
- windc3 := areaCoor2[1] + 87 - 89;
- end;
- windc2 := areaCoor1[2] - 18;
- windc4 := areaCoor2[2] - 18;
-
- if invert = true
- begin
- VUAid("invertwindowRect", {windc1, windc2, windc3, windc4});
- VUAid("invertwindowRect", {windc1, windc2, windc3, windc4});
- end;
-
- actual := VUAid("ComparewindowRect", {windc1, windc2, windc3, windc4}, 4);
- if actual = expected
- tResult := {true,"area exists for '{testName}'"};
- else
- tResult:= {false, "area not as expected for {testName}"};
-
- CAidedSE := {test, {4, "Comparewindow {windc1} {windc2} {windc3} {windc4}"}};
- rResult(tResult[1], tResult[2], expected, actual,,CAidedSE);
- end;
- end;
- end;
- else
- rResult("incomplete", "Could not find an open window");
- rCloseTest();
- end;
-
- # 09/07/95 TCS format from SPEC 1.2 TCS.lib:
- # TCSStart( pTCSId, pTextDesc, pAppName := global gAppTitle );
- # TCSEnd( pTCSId := {}, pResultCode := '', pErrStr := '', pTCSVal := 0, pTCSStr := '',
- # pCommentStr := '', pExceptionFlag := '');
- (*
- try
- match [window o:1 t:"Views" r:?wRect]!;
- catch theError
- ExceptionDispatcher(theError,,{"match in CheckArea", {testType, testList, invert}});
- *)